//
//  MyMeansViewController.m
//  EasyGo
//
//  Created by newhuidong on 16/1/21.
//  Copyright © 2016年 HuiDong. All rights reserved.
//

#import "MyMeansViewController.h"
#import "MyTableViewCell.h"
#import "NormalTableViewCell.h"
@interface MyMeansViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)UITableView * tableView;

@end

@implementation MyMeansViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    CGRect frame=[UIScreen mainScreen].bounds;
    
    self.tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)style:UITableViewStyleGrouped];
    self.tableView.delegate=self;
    self.tableView.dataSource=self;
    [self.view addSubview:self.tableView];
    
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, 40)];
    view.backgroundColor=[UIColor orangeColor];
    self.tableView.tableFooterView=view;
    
    
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 5;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * identifer=@"cell";
    
    UITableViewCell * cell=[tableView dequeueReusableCellWithIdentifier:identifer];
    if (cell==nil) {
        
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifer];
    }
    if (indexPath.section==0) {
       NSArray * nibArray=[[NSBundle mainBundle]loadNibNamed:@"MyTableViewCell" owner:self options:nil];
    
        cell=(MyTableViewCell*)[nibArray objectAtIndex:0];
    }else if (indexPath.section==1){
        
        UILabel * label=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, 130, 30)];
        label.text=@"本月在线总时长:";
        label.font=[UIFont systemFontOfSize:15];
        
        UILabel * label1=[[UILabel alloc]initWithFrame:CGRectMake(150, 10, 80, 30)];
        label1.text=@"120.8小时";
        label1.font=[UIFont systemFontOfSize:15];
        label1.textColor=[UIColor orangeColor];
        [cell.contentView addSubview:label];
        [cell.contentView addSubview:label1];
        
    }else if (indexPath.section==2){
        
        NSArray * nibArray=[[NSBundle mainBundle]loadNibNamed:@"NormalTableViewCell" owner:self options:nil];
        cell=(NormalTableViewCell*)[nibArray objectAtIndex:0];
    }else if (indexPath.section==3){
        
        
        NSArray * array=[[NSBundle mainBundle]loadNibNamed:@"NormalTableViewCell" owner:self options:nil];
        
        cell=(NormalTableViewCell *)[array objectAtIndex:0];
        
        
    }else if (indexPath.section==4){
        
        NSArray * array=[[NSBundle mainBundle]loadNibNamed:@"NormalTableViewCell" owner:self options:nil];
        
        
        cell=(NormalTableViewCell *)[array objectAtIndex:0];
        
        
    }
    
    return cell;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section==0) {
        return 120;
    }else if (indexPath.section==1){
        
        return 50;
    }else{
        
        return 100;
    }
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    return 10;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 0.1;
}
-(void)createTableViewCell:(UITableViewCell *)cell andIndexpath:(NSIndexPath *)indexpath{
    
    
    




}
@end
